<!DOCTYPE html>
<html class="x-admin-sm">

<head>
	<meta charset="UTF-8">
	<title>电子学会比赛管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
	<link rel="stylesheet" href="./css/font.css">
	<link rel="stylesheet" href="./css/common.css">
	<link rel="stylesheet" href="./css/xadmin.css">
	<script type="text/javascript" src="./js/abkj/match/api/paperscoreview.js"></script>
		<script type="text/javascript" src="./js/abkj/match/api/tmatch.js"></script>
	<script type="text/javascript" src="./js/abkj/fun_tool.js"></script>
	<script type="text/javascript" src="./js/abkj/slAjax.js"></script>
	<script src="./lib/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript" src="./js/xadmin.js"></script>
</head>

<body>
<div class="x-nav">
	<span class="layui-breadcrumb">
			<a href="">首页</a>
			<a><cite>比赛管理</cite></a>
			<a><cite>在线答题成绩</cite></a>
	</span>
	<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
		<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
	</a>
</div>
<div class="layui-fluid" >
	<div class="layui-row layui-col-space15">
		<div class="layui-col-md12">
			<div class="layui-card">
				<div class="layui-card-body ">
					<div class="layui-form layui-col-space5 flex" style="display: flex;" id="app" v-cloak>
						<!--<div class="layui-input-inline layui-show-xs-block">-->
						<!--<input class="layui-input" placeholder="开始日" name="start" id="start"></div>-->
						<!--<div class="layui-input-inline layui-show-xs-block">-->
						<!--<input class="layui-input" placeholder="截止日" name="end" id="end"></div>-->
						<div class="layui-input-inline layui-show-xs-block flex">
							<div class="mr5">赛项</div>
							<select name="project" id="saixiang">
								<option v-for="match in matchList" :value="match.theme">{{match.theme}}</option>
							</select>
						</div>

							<button class="layui-btn" onclick="search1()">
								<i class="layui-icon">&#xe615;</i></button>

					</div>
				</div>
				<div class="layui-card-header" >
					<!--<button class="layui-btn layui-btn-danger" onclick="delAll()">-->
						<!--<i class="layui-icon"></i>批量删除-->
					<!--</button>-->
					<!--<button class="layui-btn" onclick="xadmin.open('添加用户','./order-add.html',800,600)">-->
						<!--<i class="layui-icon"></i>添加-->
					<!--</button>-->
				</div>
				<div class="layui-card-body" >
					<table class="layui-table layui-form" id="table">
						<span >共计<span id="total"></span>条数据</span>
						<button style="margin-left: 10px" class="layui-btn layui-btn-sm" onclick="daochu()">导出</button>
						<script type="text/html" id="operating">
							<a href="javascript:;" onclick="parent.xadmin.open('查看成绩', 'playerAchievement.html?teamId='+{{d.signupId}}+'&saichengid='+{{d.scheduleItemId}})"   class="layui-table-link">查看成绩</a>
						</script>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script src="./js/vue.js"></script>
<script>

var form
layui.use(['form', 'table'], function () {
	 form = layui.form
	// layer.msg('玩命卖萌中', function(){
	//   //关闭后的操作
	//   });
	//监听提交
	form.on('submit(sreach)', function (data) {
		console.log(data)
		// layer.msg(JSON.stringify(data.field), function () {
		// location.href = 'index.html'
		// })
		return false
	})


})

function daochu(){
	var prjName="mgr_"
	var url='https://serviceprod.kpcb.org.cn/abkj-api-match-provider/excel/exportExcelPaperScore?Authorization='+localStorage.getItem(prjName+"token")
	var downloadLink = document.createElement('a');
					document.body.appendChild(downloadLink);

					// Use special ms version if available to get it working on Edge.

					downloadLink.href = url;
					downloadLink.target='_blank'
					// console.log(url)

					downloadLink.click();

					document.body.removeChild(downloadLink);
					window.URL.revokeObjectURL(myurl);


}
function downfile (filename, blob) {
    var downloadLink = document.createElement('a');
    document.body.appendChild(downloadLink);

    // Use special ms version if available to get it working on Edge.
   var blob = new Blob([blob]);
    var url = window.URL.createObjectURL(blob);
    downloadLink.href = url;
    console.log(url)
    downloadLink.download = filename;
    downloadLink.click();
    window.URL.revokeObjectURL(url);
    document.body.removeChild(downloadLink);
}
	var app=new Vue({
		el: '#app',
		data: {
			list:[],
			aaa: 123,
			matchList:[],

			status:['审核','待审核' ,'通过', '不通过'],
			participate:['审核','参赛' ,'弃权' ],
			cols: [ //表头
				{field: 'index', title: '序号'},
				{field: 'account', title: '账号', width: 80},
				{field: 'signupId', title: '团队ID'},
				{field: 'theme', title: '赛项'},
				{field: 'zoneName', title: '赛区'},
				{field: 'scheduleName', title: '赛程'},
				{field: 'gradeName', title: '组别'},
				{field: 'group', title: '队员成绩', templet: '#operating'},
				{field: 'points', title: '平均分', width: 135, },
			]
		},
		methods:{
			opentab:function(name,url){
				//单击事件
				console.log(name)
				console.log(url)
				xadmin.add_tab(name,url)
			},
			loadMatchList:function(){
				TmatchqueryList({},function(data){
					app.matchList=data
					// alert(JSON.stringify(app.match))

					// app.loadWorkAppeal();
				},function(status,message){
					alert(message);
				})
			},
			getData(){
				var queryData = {
				    page:{
				        current: 1, //当前页数
				        size: 10   //每页长度
				    },
				    cond:{ //条件申述
				        eq:{}
				    }
				}
				app.loadMatchList()
				setTimeout(function(){
					form.render()
				},2000)


				PaperScoreViewqueryList(queryData,function(data){
					  // alert(JSON.stringify(data))
					app.list=data;
					for(var i=0;i<app.list.length;++i){
						app.list[i].index= i
						// app.list[i].scheduleName='初赛'
						app.list[i].points=parseFloat(app.list[i].points)/100
					}

					layui.use(['laypage','table'], function () {

						var table = layui.table
						table.render({
							elem: '#table',
							url:'',
							title: '团队在线答题成绩',
							cols: [app.cols],
							page: true,
							data: app.list
						})
						document.getElementById("total").innerHTML=app.list.length

						// var laypage = layui.laypage;
						// //执行一个laypage实例
						// laypage.render({
						// 	elem: 'test1' //注意，这里的 test1 是 ID，不用加 # 号
						// 	,count: 16 //数据总数，从服务端得到
						// });
					})
				});


			},
			init:function() {
				var that = this
				// alert(JSON.stringify(app.list))

			}
		}
	})
	window.onload=function(){
		app.getData()
	}
	function search1(){
		  var list=[]
				// alert(JSON.stringify(app.list))
		  for (i=0;i<app.list.length;i++){
				var n1=app.list[i].theme
				// alert(n1)
				if (n1==undefined||n1==null){
					n1=''
				}
				// alert(document.getElementById("saixiang").value)
				if (n1.indexOf(document.getElementById("saixiang").value)>-1){
					list.push(app.list[i])
				}
			}

			layui.use(['laypage','table'], function () {
				// var laypage = layui.laypage;
				// //执行一个laypage实例
				// laypage.render({
				// 	elem: 'test1' //注意，这里的 test1 是 ID，不用加 # 号
				// 	,count: 16 //数据总数，从服务端得到
				// });
				var table = layui.table
			// alert(JSON.stringify(that.list))
				//头工具栏事件
				table.render({
					elem: '#table',
					url:'',
					title: '用户数据表',
					cols: [app.cols],
					data: list,
					count:list.length
				})
			})

	}
</script>
<script src="./js/jquery.min.js"></script>
<!--<script type="text/html" id="operating">-->
	<!--<a href="javascript:;" onclick="parent.xadmin.open('查看成绩', 'examineGrade.html')"   class="layui-table-link">查看成绩</a>-->
<!--</script>-->
<script>
	$(function () {



	})
</script>

</html>
